package com.ymatou.iapi.liveseller.service;

import java.util.ArrayList;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.livebuyer.parameter.LiveRoomInfo;
import com.ymatou.iapi.liveseller.parameter.LiveActivityProductDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*直播活动列表
*FreeMaker Template自动生成代码
*/
public class LiveActivityListCall extends YmatouBaseCall{
	private static String opurl ="api/live/LiveActivityList";
	
	public LiveActivityListCall() {
		super(EnvSetup.getSystemUrl("liveseller_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
//	LiveActivityProductDto
	public ArrayList<LiveActivityProductDto> getActivityProducts()
    {
		ArrayList<LiveActivityProductDto> data = null;
        try {
        	String liveroominfo=getJsonObject().get("Data").getAsJsonObject().get("ActivityProducts").getAsJsonArray().toString();
        	data=(ArrayList<LiveActivityProductDto>) FormatUtil.GSONToObject(liveroominfo, new TypeToken<ArrayList<LiveActivityProductDto>>() {}.getType());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}